<template>
	<view>
		<view v-if="orderList.length==0" style="color: #CCCCCC;text-align: center;width: 100%;height: 500upx;line-height: 500upx;font-size: 32upx;"> 暂无数据</view>
		<view v-else v-for="(item,index) in orderList" :key="index" class="un-recharge">
			<view class="un-recharge1">
				<text class="un-recharge1-text">时间：</text>
				<text>{{item.CREATEDATE}}</text>
				<text class="un-recharge1-text1" v-if="item.TYPE==1">+{{item.AMOUNT}}</text>
				<text class="un-recharge1-text2" v-else-if ="item.TYPE==2">-{{item.AMOUNT}}</text>
			</view>
			<view class="un-recharge2">
				<view>订单号：{{item.FROMORDERNUM}}</view>
				<view class="un-recharge2-text1" >
					<text>描述：</text>
					<text v-if="item.ORDERTYPE==1">购买商品</text>
					<text v-else-if="item.ORDERTYPE==2">充值</text>
					<text v-else-if="item.ORDERTYPE==3">提现</text>
					<text v-else-if="item.ORDERTYPE==4">退款</text>
				</view>
				<view class="un-recharge2-text" >
					<text>备注：{{item.DESCRIBE}}</text>
					<text>余额：{{item.NOWAMOUNT}} 元</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				orderList:[],
			}
		},
		onLoad(){
			this.loadData()
			uni.startPullDownRefresh();
		},
		onPullDownRefresh() {
			console.log('refresh');
			setTimeout(function () {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		methods: {
			async loadData(){
				this.$http.post('/user/queryMoneyRecord',{
					SIGNATURE : uni.getStorageSync("SIGNATURE"),
					TOKEN: uni.getStorageSync("userInfo").TOKEN,
				}).then((res1)=>{
					
					//判断返回内容
					if(res1.data.STATE === "0" && res1.statusCode === 200){
						console.log("66666662222",res1)
						this.orderList=res1.data.OBJECT;
					}
				})
				.catch((err1)=>{
					console.log('request fail', err1);
				})
			},
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #F5F5F5;
		padding: 20upx 30upx;
		/* #ifdef MP-WEIXIN */
		width: 92%;
		/* #endif */
	}
	.un-recharge{
		border-radius: 10upx;
		background-color: #FFFFFF;
		margin-bottom: 20upx;
		padding: 20upx 30upx;
		.un-recharge1{
			color: #666666;
			font-size: 28upx;
			line-height: 80upx;
			.un-recharge1-text{
				color: #999999;
				font-size: 25upx;
			}
			.un-recharge1-text1{
				float: right;
				color: #F04844;
			}
			.un-recharge1-text2{
				float: right;
				color: #4DB34D;
			}
		}
		.un-recharge2{
			color: #999999;
			font-size: 25upx;
			line-height: 40upx;
			.un-recharge2-text{
				// float: left;
				display: flex;
				margin-top: 10upx;
				-webkit-justify-content: space-between;
				justify-content: space-between;
			}
			.un-recharge2-text1{
				// float: left;
				display: flex;
				margin-top: 10upx;
			}
		}
	}
</style>
